package springboot1706.activemq;

import javax.annotation.Resource;
import javax.jms.Queue;

import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class Producer {

	@Resource
	private JmsMessagingTemplate jmsMessagingTemplate;
	
	@Resource
	private Queue queue;
	
	@RequestMapping("/sendMessage/{msg}")
	public void sendMessage(@PathVariable("msg") String msg) {
		jmsMessagingTemplate.convertAndSend(queue, msg);
	}
}
